#include "AlarmTimer.h"
#include "time.h"
#include "ComLog.h"
#include "ComLogUdp.h"







void second_5_s(union sigval v)
{

  printf("5s alarm\n");

}

void second_3_s()
{

  printf("3s alarm\n");

}

void second_1_s(union sigval v)
{

  printf("1s alarm\n");

}

time_t OsUtilsGetmSencond()
{
    struct timespec times;
    clock_gettime(CLOCK_MONOTONIC, &times);
    return times.tv_sec * 1000 + times.tv_nsec / 1000000;
}

void  LogHook1(char *log_str)
{

   //printf("%s", log_str);
   ComLogUdp(log_str);
} 


int main(void)
{
   char a[] = {1,2,5,7,9,2,4,7,9,0,3,5,6,15,2,1,21};
   // AlarmTimerOnce(second_3_s, 20);
    //timer_t fd = TimerCreate(second_5_s, 5000000);
    //timer_t fd1 = TimerCreate(second_3_s, 3000000);
    //timer_t fd2 = TimerCreate(second_1_s, 1000000);
    ComLogSetHook(LogHook1);
    while(1)
    {
       sleep(2);
       COMLOG_FATAL_LOG("%s","dsadasdsa\n");
       COMLOG_FATAL_HEXDUMP(a, sizeof(a));
     // printf(">>>> %ld\n", OsUtilsGetmSencond());
    }
    return 0;
}
